
import request from '@/utils/request'
/**
 * 新增部门
 * @param {code,introduce,manager,name,pid}data
 * @returns 
 */
export function addDepartments(data){
  return request({
    url:'/company/department',
    method:'post',
    data //请求体body
  })
}

/**
 * 获取所有部门
 * @returns 
 */
 export function getDepartments(){
  return request({
    url:'/company/department',
    method:'get'
  })
}

/**
 * 修改部门
 * @param {code,introduce,manager,name,pid}data
 * @returns 
 */
 export function updateDepartments(data){
  return request({
    url:`/company/department/${data.id}`,
    method:'put',
    data //请求体body
  })
}

/**
 * 删除指定的部门
 * @returns 
 */
 export function delDepartments(id){
  return request({
    url:`/company/department/${id}`,
    method:'delete'
  })
}

/**
 * 获取指定的部门数据
 * @returns 
 */
 export function getDepartmentsDetail(id){
  return request({
    url:`/company/department/${id}`,
    method:'get'
  })
}